package javaBase.nowcoder.HJ32_S_密码截取;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/*
https://www.nowcoder.com/practice/3cd4621963e8454594f00199f4536bb1?tpId=37&rp=1&ru=%2Fexam%2Foj%2Fta&qru=%2Fexam%2Foj%2Fta&sourceUrl=%2Fexam%2Foj%2Fta%3FjudgeStatus%3D3%26page%3D1%26pageSize%3D50%26search%3D%26tpId%3D37%26type%3D37&difficulty=3&judgeStatus=1&tags=&title=&gioEnter=menu
* */
public class Main {


    public static void main(String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        String s = br.readLine();
        br.close();
        int max = 1;
        for (int i = 0; i < s.length(); i++) {
            int l1 = maxlength(i - 1, i, s);
            int l2 = maxlength(i, i, s);
            max = Math.max(max, Math.max(l1, l2));

        }
        System.out.println(max);
    }
    public static int maxlength(int left, int right, String s) {
        while (left >= 0 && right < s.length() && s.charAt(left) == s.charAt(right)) {
            left--;
            right++;
        }
        return right - left - 1;
    }
}
